﻿using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using FutureApp.Users;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FutureApp.Orders
{
    /// <summary>
    /// 主表
    /// </summary>
    [Table("OrderMain")]
    public class OrderMain : FullAuditedEntity<Guid, User>, IPassivable
    {
        /// <summary>
        /// 属性的最大长度
        /// </summary>
        public const int MaxNameLength = 50;
        /// <summary>
        /// 期数
        /// </summary>
        [StringLength(MaxNameLength)]
        public virtual string Num { get; set; }
        /// <summary>
        /// 金额
        /// </summary>
        [Required]
        public virtual double MainPrice { get; set; }
        /// <summary>
        /// 还款日
        /// </summary>
        [Required]
        public virtual DateTime MainDate { get; set; }
        /// <summary>
        /// 状态：1未还清，2已还清，3逾期
        /// </summary>
        [Required]
        public virtual int? MainType { get; set; } = 1;
        /// <summary>
        /// 激活/禁用
        /// </summary>
        [Required]
        public virtual bool IsActive { get; set; } = true;

        /// <summary>
        ///外键
        /// </summary>
        public virtual Guid HeadId { get; set; }

        /// <summary>
        ///外键
        /// </summary>
        [ForeignKey("HeadId")]
        public virtual OrderHead OrderHead { get; set; }

    }
}
